FROM private-registry.sohucs.com/base/golang:1.16-alpine

MAINTAINER GuoFeng <fengguo217330@sohu-inc.com>

ENV GOPROXY=https://mirrors.aliyun.com/goproxy/|https://goproxy.io|https://goproxy.cn|direct
ENV GO111MODULE=on
ENV GOPRIVATE=code.sohuno.com

ENV APP_PATH /opt/app
ENV APP_LOG_PATH /var/log/1024/
ENV PATH .:$PATH

WORKDIR ${APP_PATH}
RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories
RUN apk add -U git tzdata curl iputils net-tools 
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime

ARG PROG_ENTRY_POINT

VOLUME ${APP_LOG_PATH}

COPY go.mod ./
RUN go mod download
COPY . ${APP_PATH}

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o binexec ${APP_PATH}/${PROG_ENTRY_POINT}

EXPOSE 8080
CMD ["sh", "-c", "binexec \"$ARG_LIST\""]
